999591a7da87ab66f0154f92657062f8aab9310f,src/main/java/org/jenkinsci/plugins/configfiles/maven/job/MvnGlobalSettingsProvider.java,MvnGlobalSettingsProvider,supplySettings,#AbstractBuild#TaskListener#,75

Before Change


                            }
                        }

                        FilePath configurationFile = build.getWorkspace().createTextTempFile("global-settings", ".xml", fileContent, false);
                        LOGGER.log(Level.FINE, "Create {0}", new Object[]{configurationFile});
                        build.getEnvironments().add(new SimpleEnvironment("MVN_GLOBALSETTINGS", configurationFile.getRemote()));

After Change


                if (StringUtils.isNotBlank(config.content)) {
                    try {

                        FilePath workspace = build.getWorkspace();
                        if (workspace != null) {
                            FilePath workDir = ManagedFileUtil.tempDir(workspace);
                            String fileContent = config.content;

                            final Map<String, StandardUsernameCredentials> resolvedCredentials = CredentialsHelper.resolveCredentials(build, config.getServerCredentialMappings());
                            final Boolean isReplaceAll = config.getIsReplaceAll();

                            if (resolvedCredentials != null && !resolvedCredentials.isEmpty()) {
                                List<String> tempFiles = new ArrayList<String>();
                                fileContent = CredentialsHelper.fillAuthentication(fileContent, isReplaceAll, resolvedCredentials, workDir, tempFiles);
                                for (String tempFile : tempFiles) {
                                    build.addAction(new CleanTempFilesAction(tempFile));
                                }
                            }

                            FilePath configurationFile = workspace.createTextTempFile("global-settings", ".xml", fileContent, false);
                            LOGGER.log(Level.FINE, "Create {0}", new Object[]{configurationFile});
                            build.getEnvironments().add(new SimpleEnvironment("MVN_GLOBALSETTINGS", configurationFile.getRemote()));

                            // Temporarily attach info about the files to be deleted to the build - this action gets removed from the build again by
                            // 'org.jenkinsci.plugins.configfiles.common.CleanTempFilesRunListener'
                            build.addAction(new CleanTempFilesAction(configurationFile.getRemote()));
                            return configurationFile;
                        } else {
                            listener.getLogger().println("ERROR: can't supply maven settings, workspace is null / slave seems not contected...");
                        }
                    } catch (Exception e) {
                        throw new IllegalStateException("the global settings.xml could not be supplied for the current build: " + e.getMessage());